<?php
/* @var $this CategoryController */
/* @var $model Category */
/* @var $form CActiveForm */
?>

<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'category-form',
	// Please note: When you enable ajax validation, make sure the corresponding
	// controller action is handling ajax validation correctly.
	// There is a call to performAjaxValidation() commented in generated controller code.
	// See class documentation of CActiveForm for details on this.
	'enableAjaxValidation'=>true,
    'errorMessageCssClass'=>'alert alert-danger',
    'htmlOptions'=>array('enctype'=>'multipart/form-data')
)); ?>

    <div class="block">
        <div class="row">
            <?php echo $form->labelEx($model,'title'); ?>
        </div>
        <div class="row">
            <?php echo $form->error($model,'title'); ?>
            <?php echo $form->textField($model,'title',array('size'=>60,'maxlength'=>256,'class'=>'form-control')); ?>
        </div>
    </div>

    <div class="block">
        <div class="row">
            <?php echo $form->labelEx($model,'parent_id'); ?>
        </div>
        <div class="row">
            <?php echo $form->error($model,'parent_id'); ?>
            <?php echo CHtml::activeDropDownList($model,'parent_id', array('0'=>'КОРНЕВАЯ КАТЕГОРИЯ') + $list, array('class'=>'form-control', 'options'=>$disabled)); ?>
        </div>
    </div>

    <div class="block">
        <div class="row">
            <?php echo $form->labelEx($model,'description'); ?>
        </div>
        <div class="row">
            <?php echo $form->error($model,'description'); ?>
            <?php echo $form->textArea($model,'description',array()); ?>
        </div>
    </div>

    <div class="block">
        <div class="row">
            <?php echo $form->labelEx($model,'image'); ?>
        </div>
        <div class="row">
            <?php echo $form->error($model,'image'); ?>
            <?php echo $form->fileField($model,'image', array('name'=>'categoryImage','size'=>60)); ?>
        </div>
    </div>

    <div>
        <img src='<?php echo Yii::app()->request->baseUrl."/images/".$model->image ?>'/>
    </div>

    <div class="block">
        <div class="row">
            <?php echo $form->checkBox($model,'is_visible'); ?>
            <?php echo $form->labelEx($model, 'is_visible'); ?>
            <?php echo $form->error($model,'is_visible'); ?>
        </div>
    </div>

    <!--	<div class="row">-->
    <!--		--><?php //echo $form->labelEx($model,'tags'); ?>
    <!--		--><?php //echo $form->textField($model,'tags',array('size'=>60,'maxlength'=>256)); ?>
    <!--		--><?php //echo $form->error($model,'tags'); ?>
    <!--	</div>-->
    <!---->
    <!--	<div class="row">-->
    <!--		--><?php //echo $form->labelEx($model,'url'); ?>
    <!--		--><?php //echo $form->textField($model,'url',array('size'=>60,'maxlength'=>256)); ?>
    <!--		--><?php //echo $form->error($model,'url'); ?>
    <!--	</div>-->

    <div class="row buttons">
        <?php echo CHtml::submitButton($model->isNewRecord ? 'Создать' : 'Сохранить', array('class' => 'btn btn-info')); ?>
    </div>

<?php $this->endWidget(); ?>

</div><!-- form -->
